package com.techsoft.plugins;

import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;

public class IOUtils {
	public static void copy(InputStream in, OutputStream out, byte[] buf)
			throws IOException {
		int len = in.read(buf, 0, buf.length);
		while (len != -1) {
			out.write(buf, 0, len);
			len = in.read(buf, 0, buf.length);
		}
		out.flush();
	}

	public static void copy(InputStream in, OutputStream out, int buf)
			throws IOException {
		byte[] buff = new byte[buf];
		int len = in.read(buff, 0, buff.length);
		while (len != -1) {
			out.write(buff, 0, len);
			len = in.read(buff, 0, buff.length);
		}

		out.flush();
	}
}
